import request from '@/utils/request'

// 查询【长期工】列表
export function listWorker(query) {
  return request({
    url: '/termWorkerApi/list',
    method: 'get',
    params: query
  })
}

// 查询【长期工】详细
export function getWorker(id) {
  return request({
    url: '/termWorkerApi/' + id,
    method: 'get'
  })
}

// 新增【长期工】
export function addWorker(data) {
  return request({
    url: '/termWorkerApi',
    method: 'post',
    data: data
  })
}

// 修改【长期工】
export function updateWorker(data) {
  return request({
    url: '/termWorkerApi',
    method: 'put',
    data: data
  })
}

//  【长期工】加入黑名单
export function updateWorkStatus(form) {
  return request({
    url: '/termWorkerApi/addToBlacklist/',
    method: 'post',
    data: form
  })
}

// 批量设置【长期工】离职

export function updateTermWorkerLeaveTime(ids) {
  return request({
    url: '/termWorkerApi/updateTermWorkerLeaveTime/' + ids,
    method: 'delete'
  })
}

// 删除【长期工】
export function delWorker(id) {
  return request({
    url: '/termWorkerApi/' + id,
    method: 'delete'
  })
}

// 导出【长期工】
export function exportWorker(query) {
  return request({
    url: '/termWorkerApi/export',
    method: 'get',
    params: query
  })


}

// 查询组织结构列表
export function listDept() {
  return request({
    url: '/termWorkerApi/listDept',
    method: 'get'

  })
}
// 查询组织结构列表
export function listProfessionRank() {
  return request({
    url: '/termWorkerApi/optionProfessionRank',
    method: 'get'

  })
}

// 查询【长期工流水】列表
export function listWorkerLog(query) {
  return request({
    url: '/termWorkerApi/listTermWorkerLogList',
    method: 'get',
    params: query
  })
}

export function uploadPic(url, file) {
  let data = new FormData();

  file.forEach(everyFile => {
    data.append("file", everyFile.raw);
  });
  return request({
    url: url,
    method: "post",
    data: data
  });
}
// 查询【考勤组】列表
export function listTermAttendanceGroup(query) {
  return request({
    url: '/termWorkerApi/listTermAttendanceGroup',
    method: 'get',
    params: query
  })
}
// 查询【长期工修改流水】列表
export function listLog(query) {
  return request({
    url: '/termWorkerApi/listLog',
    method: 'get',
    params: query
  })
}


